
package com.ami.kvm.jviewer.gui;

import com.ami.kvm.jviewer.Debug;
import com.ami.kvm.jviewer.jvvideo.JVVideo;
import com.ami.kvm.jviewer.kvmpkts.KVMClient;
import java.util.Timer;
import java.util.TimerTask;

public class PowerStatusMonitor extends TimerTask {
	private boolean monitorRunning = false;
	private final Object syncObj = new Object();

	public static final long WAIT_TIME = 30000L;

	public boolean isMonitorRunning() {
		return this.monitorRunning;
	}

	public Object getSyncObj() {
		return this.syncObj;
	}

	public void run() {
		if (JViewerApp.getInstance().getKVMClient().m_isBlank) {
			JViewerApp.getInstance().getKVMClient().sendPowerStatusRequest();
		}
		this.monitorRunning = true;

		try {
			synchronized (getSyncObj()) {
				getSyncObj().wait(30000L);
			}
		} catch (InterruptedException localInterruptedException) {
			Debug.out.println("PowerStatusMonitor wait Interrupted");
			Debug.out.println(localInterruptedException);
		}

		if (JViewerApp.getInstance().getVidClnt().isNewFrame()) {
			this.monitorRunning = false;

			cancel();
			if (JViewerApp.getInstance().getVidClnt().getPsMonitorTimer() != null) {
				JViewerApp.getInstance().getVidClnt().getPsMonitorTimer().cancel();
			}
			JViewerApp.getInstance();
			JViewerApp.getInstance().onGetPowerControlStatus((byte) 1);
		}
	}
}

/*
 * Location: D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\gui\
 * PowerStatusMonitor.class Java compiler version: 5 (49.0) JD-Core Version:
 * 0.7.1
 */